import pymysql
from lxml import etree
import requests
import json
import re
import time
from walmart.字段 import words
import random
import parsel
from walmart.selenium_walmart import yidong

conn = pymysql.connect(host='gz-cdb-ezvn7csl.sql.tencentcdb.com', port=58892, user='root', password='shengye2021',
                       database='bailun_bltpro', charset='utf8')
cursor = conn.cursor()

def cook():
    co=[
        'AID=wmlspartner%253D0%253Areflectorid%253D0000000000000000000000%253Alastupd%253D1637050244515; ACID=e57a8b4c-df53-4682-85a9-a0f6cf417ed1; hasACID=true; locDataV3=eyJpbnRlbnQiOiJTSElQUElORyIsInBpY2t1cCI6W3siYnVJZCI6IjAiLCJub2RlSWQiOiIzMDgxIiwiZGlzcGxheU5hbWUiOiJTYWNyYW1lbnRvIFN1cGVyY2VudGVyIiwibm9kZVR5cGUiOiJTVE9SRSIsImFkZHJlc3MiOnsicG9zdGFsQ29kZSI6Ijk1ODI5IiwiYWRkcmVzc0xpbmUxIjoiODkxNSBHZXJiZXIgUm9hZCIsImNpdHkiOiJTYWNyYW1lbnRvIiwic3RhdGUiOiJDQSIsImNvdW50cnkiOiJVUyIsInBvc3RhbENvZGU5IjoiOTU4MjktMDAwMCJ9LCJnZW9Qb2ludCI6eyJsYXRpdHVkZSI6MzguNDgyNjc3LCJsb25naXR1ZGUiOi0xMjEuMzY5MDI2fSwiaXNHbGFzc0VuYWJsZWQiOnRydWUsInNjaGVkdWxlZEVuYWJsZWQiOnRydWUsInVuU2NoZWR1bGVkRW5hYmxlZCI6dHJ1ZX1dLCJzaGlwcGluZ0FkZHJlc3MiOnsibGF0aXR1ZGUiOjM4LjQ4MjY3NywibG9uZ2l0dWRlIjotMTIxLjM2OTAyNiwicG9zdGFsQ29kZSI6Ijk1ODI5IiwiY2l0eSI6IlNhY3JhbWVudG8iLCJzdGF0ZSI6IkNBIiwiY291bnRyeUNvZGUiOiJVUyIsImxvY2F0aW9uQWNjdXJhY3kiOiJsb3ciLCJnaWZ0QWRkcmVzcyI6ZmFsc2V9LCJhc3NvcnRtZW50Ijp7Im5vZGVJZCI6IjMwODEiLCJkaXNwbGF5TmFtZSI6IlNhY3JhbWVudG8gU3VwZXJjZW50ZXIiLCJhY2Nlc3NQb2ludHMiOm51bGwsImludGVudCI6IlBJQ0tVUCIsInNjaGVkdWxlRW5hYmxlZCI6ZmFsc2V9LCJpbnN0b3JlIjpmYWxzZSwicmVmcmVzaEF0IjoxNjM3MDUzODQ0NjQyLCJ2YWxpZGF0ZUtleSI6InByb2Q6djI6ZTU3YThiNGMtZGY1My00NjgyLTg1YTktYTBmNmNmNDE3ZWQxIn0%3D; assortmentStoreId=3081; hasLocData=1; locGuestData=eyJpbnRlbnQiOiJTSElQUElORyIsInN0b3JlSW50ZW50IjoiUElDS1VQIiwibWVyZ2VGbGFnIjpmYWxzZSwicGlja3VwIjp7Im5vZGVJZCI6IjMwODEiLCJ0aW1lc3RhbXAiOjE2MzcwNTAyNDQ2MzJ9LCJwb3N0YWxDb2RlIjp7InRpbWVzdGFtcCI6MTYzNzA1MDI0NDYzMiwiYmFzZSI6Ijk1ODI5In0sInZhbGlkYXRlS2V5IjoicHJvZDp2MjplNTdhOGI0Yy1kZjUzLTQ2ODItODVhOS1hMGY2Y2Y0MTdlZDEifQ%3D%3D; TB_Latency_Tracker_100=1; TB_Navigation_Preload_01=1; TB_DC_Flap_Test=1; vtc=YeDTYcBVVJrmBJn6nfVFmc; bstc=YeDTYcBVVJrmBJn6nfVFmc; mobileweb=0; xpa=CfaEu; exp-ck=CfaEu1; _pxhd=/31pu0tzO1ECcUVm0TNn55u-08C8rpNRCZvDOnL0MqLMAibINQJeQKaDDvcYPc1t4aVGFFOHJF2ht5J3fmevnA==:cmMqj7pGW6pBtipT-FCLoSRKW8QFZbs9jtK6utKFrbUui5K5oAfhXrjVRb0Gv436XRrw0DmPDSSvuxbDsDiF5CJo-n81taZQaeSbCSP0gNI=; TBV=7; adblocked=false; pxcts=bbc3ed41-46b4-11ec-8697-fdbb46d83dd9; _pxvid=b2839e3b-46b4-11ec-a6e3-585a4b527450; ak_bmsc=8AABA27234D5386498DC3DA580A8A827~000000000000000000000000000000~YAAQDtrIF1iSSw99AQAAaZ/MJw2QCZ7NqEcAk4OJmEFCvIipXAXmk7y7iPC0L1lsWk26hecPTR2SEHacE+1LXGJ7rfnSCLIXHhT+2z+yeoJZF1krANdZEJVfxc9a8TjPMmLkCZscgR2z9s8qTYJkeLy6lxxUlD2lpiNQGJ9KCtTzZUXZBN+/2HbUBPHFLqlTjklgJ28KpzDsnzxG7owlkGObkXsPSNaTv2AGmmGBqoitQOzgr/OVE6kiUT2Qpmxlm6AfzWdMqXqYD0I8Dq1a3I3TkQasvK4TLEeBmLAunBjVD5sW4t4jC+5uf7iOj8vA3rD8t7/OmYBXxG6oSxFEKuGYK76ijpVNnWBiztTWJv+YjofLYls375KaeFGSwoixTnDjlB495XpZFxXDe9HoMNhbEKSLoeFDIf/CbpjwNB9bQNUxi1tEMl2n9rEO5C63LAis3U9NbMGfovsCePa6NUL8Jjcupa+En4AfTTA=; xpm=1%2B1637050244%2BYeDTYcBVVJrmBJn6nfVFmc~%2B0; tb_sw_supported=true; TB_SFOU-100=1; akavpau_p2=1637052508~id=91997cd6658b0a7566794db6c542e699; com.wm.reflector="reflectorid:0000000000000000000000@lastupd:1637051925000@firstcreate:1637050244515"; xptwg=2896669889:16834EFF5CF7C80:3B109BE:72E878EE:7F11AD15:5663913B:; TS01b0be75=01538efd7c81328bbb6eff6dd23390172201515443bf6c134fce8f64ddccda398e68c29d974899c599e59edd6d84c2e538cc979fe9; TS013ed49a=01538efd7c81328bbb6eff6dd23390172201515443bf6c134fce8f64ddccda398e68c29d974899c599e59edd6d84c2e538cc979fe9; bm_sv=A4501CB648113980B59BAAE1B05D5CC2~xkRIXprLft9ygnxDqx/fxqRsYOkmsY24QtxriB8SWuX63le4ZJuCCQc4ycCyIEoh5P1HcK9fGMia+XyzKMZX507WFn/A3hR/pyK14taRLCNkYiSd9lxXZB6qw3kXLZoxXLgO56HIv8bUXDfjRoWnVeziSypn4b/Qa+wAMGTjaz8=',
        'ACID=50965586-9358-4dda-b9f3-d9e0502006d6; hasACID=true; assortmentStoreId=3081; locGuestData=eyJpbnRlbnQiOiJTSElQUElORyIsInN0b3JlSW50ZW50IjoiUElDS1VQIiwibWVyZ2VGbGFnIjpmYWxzZSwicGlja3VwIjp7Im5vZGVJZCI6IjMwODEiLCJ0aW1lc3RhbXAiOjE2MzczMTQ3MTM5NDN9LCJwb3N0YWxDb2RlIjp7InRpbWVzdGFtcCI6MTYzNzMxNDcxMzk0MywiYmFzZSI6Ijk1ODI5In0sInZhbGlkYXRlS2V5IjoicHJvZDp2Mjo1MDk2NTU4Ni05MzU4LTRkZGEtYjlmMy1kOWUwNTAyMDA2ZDYifQ==; vtc=VIdTZRHgeDxx66v6epboSg; TBV=f; adblocked=false; _pxvid=768515e0-491c-11ec-b420-674d426e6675; tb_sw_supported=true; AID=wmlspartner%3D0%3Areflectorid%3D0000000000000000000000%3Alastupd%3D1637314848788; hasLocData=1; TB_Latency_Tracker_100=1; TB_Navigation_Preload_01=1; TB_SFOU-100=1; pxcts=e954ea50-4b61-11ec-94b3-edeec1dff10d; TS013ed49a=01538efd7ce684456f0660bf687088296823abbb51a37cf633bd6bb1076c72afdd43cb7191c211fa96ba02f77278b3d88102206167; ak_bmsc=8E7B4E6E3B754982900842FBFEE435A3~000000000000000000000000000000~YAAQFQEPF9mP1UJ9AQAAk+RlSg0uR7qKA0uUfwPHRei/uwSjKj8/2f6pZpySc8+fVXAHCnmBnLd7fEggrsr/V/9gYdOZZFCZb5DFbik1ynOKudDoTCoURWVwh0H1LBhWdBxLTaVR1PmAmygOsmx2OwJ9cwJGHKsaFeRdspsq+9+cyMnUhJdEcRlzyUdRAo70wAOUiuuBMXnIuaZBiCJh6bLbIQ4ZpeXcXLK4hlETi4/cMIe4gsHEvOaJln0htJCnUsTxa6ljlT8wG8vU5PC47p7/duF5L7wGkv0SfPTWzKTBaildcdfLGNBE5k/+AijWHj8dYT4Kp/GT1jMlH0hC2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tVUCIsInNjaGVkdWxlRW5hYmxlZCI6ZmFsc2V9LCJpbnN0b3JlIjpmYWxzZSwicmVmcmVzaEF0IjoxNjM3NjU0MTEwNDM2LCJ2YWxpZGF0ZUtleSI6InByb2Q6djI6NTA5NjU1ODYtOTM1OC00ZGRhLWI5ZjMtZDllMDUwMjAwNmQ2In0=; TB_DC_Flap_Test=0; bstc=Rn_X9En_hP-Ft9qAc0Yi58; mobileweb=0; xpa=; xpm=3+1637632510+VIdTZRHgeDxx66v6epboSg~+0; _pxhd=uy2saJD0LOTyIHIbGFSQ-MYlyp-v43QCq6fJwmxgWmANUZeC1FsqYvTRxM5mwd/lrxEwZFGD7rmcEdp7AUKOWA==:XrR0hmXzEibj5x-WiaUV0lGt7yJwG8KT/TGQjos--gnP76xYou-6mNmm4vMNGddHkcULKZXsLUb82vq1qdWEV0YtHn7Llsp7cGgW3nSna-8=; akavpau_p2=1637633110~id=643be8419cc346922cb592af9a14c8dc; com.wm.reflector="reflectorid:0000000000000000000000@lastupd:1637632511000@firstcreate:1637314713843"; xptwg=186702042:8F5860151BCD00:177F26E:DC50D374:A5F33C0A:FC2846DC:; bm_sv=2386F22E873A0C6BAF936DC0F3C3B15D~f1BG8ZwkcJOthLtq1RVAd4k/DRWUxNqO0DD4Ru/Tl5Nbc1VIWcu2B2xYKyIqthsWBAjk9V6fUz0RZhxf/HdJ0v6u21qT1F4l/pkBdKBQCQwfYnah0Y41201UBUFB8ayVVdki14mIBTcYdNg7rG2kqwFNhO6n0/ZoYvD7lblG2/M=; _px3=0ff65373afdb27a05671ea767a032cd73977484b2a131344e055c42a11bfa09d:VcM+IdJzDkC7YY1emztwSaPOzXiT0Uiufp4rHkOenPYg4ndZhi0HZD9QNol0qniwcoe1QbNWx/fYG5sHVvINsA==:1000:ZaGXsFbf2smsPK+mIVtvbj+5OZrbSXRmJo9RNhNIvTsIXg+SzP2UPdszBSfN+P4dQcY7ypaEOW5wpvI47XPMn0yXAP+Z5t4L25oMTm1yaJoQRzky6rZHsqHxpUipSZsO3YIZft7mh8tZbqL/UpzqDPIbUI41uav1GaHuswOWGamEoPaZcyQBdnScDKwrPB7y0WVzVXgKaBySvVPRUCf/7A==; _pxde=48e85f6011950201a1186957de1fb55e718fd66e9a12ee0492e3e6756b1403cb:eyJ0aW1lc3RhbXAiOjE2Mzc2MzI1Nzg0ODQsImZfa2IiOjAsImlwY19pZCI6W119',
        'AID=wmlspartner%3D0%3Areflectorid%3D0000000000000000000000%3Alastupd%3D1637050244515; ACID=e57a8b4c-df53-4682-85a9-a0f6cf417ed1; hasACID=true; locGuestData=eyJpbnRlbnQiOiJTSElQUElORyIsInN0b3JlSW50ZW50IjoiUElDS1VQIiwibWVyZ2VGbGFnIjpmYWxzZSwicGlja3VwIjp7Im5vZGVJZCI6IjMwODEiLCJ0aW1lc3RhbXAiOjE2MzcwNTAyNDQ2MzJ9LCJwb3N0YWxDb2RlIjp7InRpbWVzdGFtcCI6MTYzNzA1MDI0NDYzMiwiYmFzZSI6Ijk1ODI5In0sInZhbGlkYXRlS2V5IjoicHJvZDp2MjplNTdhOGI0Yy1kZjUzLTQ2ODItODVhOS1hMGY2Y2Y0MTdlZDEifQ==; vtc=YeDTYcBVVJrmBJn6nfVFmc; TBV=7; adblocked=false; _pxvid=b2839e3b-46b4-11ec-a6e3-585a4b527450; tb_sw_supported=true; assortmentStoreId=3081; hasLocData=1; TB_Latency_Tracker_100=1; TB_Navigation_Preload_01=1; TB_SFOU-100=1; pxcts=6ed258c0-4b62-11ec-82f8-f9a9d8a34d30; _pxhd=r6dvKON-u/RjdIQSrB34fY7g4DCVHj/mEQ5yGlyO0mv8xR6-JrRmAQx2aZcyaCQU/fX4vhnYe-7OxAJkV5cC/g==:5vEXDF0wSSODK44ckJmsp0E6zYSTDHW/AFYC8AQI7gqhUHBFlgsA0XqTwDXxIk8Y3QMcHCR6DFvyOnQ7ZZLrTStEZOJRSMfo4QkeARg9FVk=; ak_bmsc=EA4AF027AFDB1663EAF545B6BB2E7613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=; TB_DC_Flap_Test=0; bstc=ajKMIo9vpwlbEzyAmfv2zo; mobileweb=0; xpa=; xpm=3+1637630743+YeDTYcBVVJrmBJn6nfVFmc~+0; TS013ed49a=01538efd7c32d7496ea18b1a1ca858c08f902427e4bc4aff07ca0ac02f177dcf50c303d399a76f14641c1089c34d0f5786d977e6cd; akavpau_p2=1637632960~id=9fbbd4eaa8ec248b4889a08a941d3908; com.wm.reflector="reflectorid:0000000000000000000000@lastupd:1637632509000@firstcreate:1637050244515"; xptwg=3021189219:D3840132F7BE18:22ABC45:41AFFF83:37FFD299:3C8D9AD2:; bm_sv=3BF044EF2510F863A9462B794F321732~f1BG8ZwkcJOthLtq1RVAdyb6l+JVo5dSK6W8+zPYNaXFgJnVxfN5JSfMDNtnfsPZZUizI+PStcfL/HwEtZUdAi8Nujh1B820SedU3paICCfxXZgbITDVh7NNC3IELBKKgOkbvmaSp4jhQopd/gWTTg9gcdEYrmunyDoTSMbjmxE=; TS01b0be75=01503b2d70a7e3e9cbb724598f0fe71ed3a3261d4c87df96c4153decdaae851d66c76c5b16a67e6329ff6fc7288de7169d14aee42a; _px3=fe1daf206043887ae42515921c1ecd51782e6bf63527a92c97a9532d8c8e272c:TvnXH6jacnlXj5Ue26iio9/bEX+7cWgzJ3N65XIuhngsP7UtVS54463Y9JnatVAsXgxy+coFbHJatkV8gXkgkg==:1000:u3xoi0+w2AMvzMvU1nBmhCdqaklf0vXlcvenYwB/efOvefN34IL+CvFeXoV8YWKNry66npGcSeAxViXzBpXrWf9SnHxq6HR8hiAM2YGxXMuKA0+cUsaBVC2P99sh+fTKRTvwhRTMm63NVRTVb/0eXK1632PGx0b+HNsHz361j0hAxsh+j6lqCpRSQVW7GrsnSiz57IvHmDpjilwZc310vg==; _pxde=6017867cbd9d9305c898ef541b3f4f1c6be46aeb1fc83a2454bf00037fa52a4c:eyJ0aW1lc3RhbXAiOjE2Mzc2MzM1MDkxNDgsImZfa2IiOjAsImlwY19pZCI6W119',
        'AID=wmlspartner%3D0%3Areflectorid%3D0000000000000000000000%3Alastupd%3D1637050244515; ACID=e57a8b4c-df53-4682-85a9-a0f6cf417ed1; hasACID=true; locGuestData=eyJpbnRlbnQiOiJTSElQUElORyIsInN0b3JlSW50ZW50IjoiUElDS1VQIiwibWVyZ2VGbGFnIjpmYWxzZSwicGlja3VwIjp7Im5vZGVJZCI6IjMwODEiLCJ0aW1lc3RhbXAiOjE2MzcwNTAyNDQ2MzJ9LCJwb3N0YWxDb2RlIjp7InRpbWVzdGFtcCI6MTYzNzA1MDI0NDYzMiwiYmFzZSI6Ijk1ODI5In0sInZhbGlkYXRlS2V5IjoicHJvZDp2MjplNTdhOGI0Yy1kZjUzLTQ2ODItODVhOS1hMGY2Y2Y0MTdlZDEifQ==; vtc=YeDTYcBVVJrmBJn6nfVFmc; TBV=7; adblocked=false; _pxvid=b2839e3b-46b4-11ec-a6e3-585a4b527450; tb_sw_supported=true; assortmentStoreId=3081; hasLocData=1; TB_Latency_Tracker_100=1; TB_Navigation_Preload_01=1; TB_SFOU-100=1; pxcts=6ed258c0-4b62-11ec-82f8-f9a9d8a34d30; _pxhd=r6dvKON-u/RjdIQSrB34fY7g4DCVHj/mEQ5yGlyO0mv8xR6-JrRmAQx2aZcyaCQU/fX4vhnYe-7OxAJkV5cC/g==:5vEXDF0wSSODK44ckJmsp0E6zYSTDHW/AFYC8AQI7gqhUHBFlgsA0XqTwDXxIk8Y3QMcHCR6DFvyOnQ7ZZLrTStEZOJRSMfo4QkeARg9FVk=; ak_bmsc=EA4AF027AFDB1663EAF545B6BB2E7613~000000000000000000000000000000~YAAQjK/tzPL9dw19AQAA68RRSg06yChpDx4pfSMe0RvCLh7yUWWvrpeAxplfvcTH7vf1JGF1RnHqSRrqzt+IqakNjgWx38BSramtUI6aUd3XNj2ogr5iJQYycvkNKhcJwhMKXg33vOPKaCxZNdX6HJPgMJIpH+adfgfKyDmEQKprz20MQUCc1YYUAkfPFHjGDg+WimakLPicxIUQhcXSRF77NwASLIMZ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jLzfZ9dTkdF/5mvs767wuZloTfhm7Wk2KcjygglTqinKgSpV0hco0QKmh1CakFS+talRIupwnY65O9IPm/8h90De3TZDsXp8tQe7zbeZFyV7y7yAPWfaw2U/5/sUMk70P8glgOEpLOprhDfMywI05adPtwc9/m5r1ONHR2MHgaT3GSSkX1t2O2E3L5yC67XZNwFiKC3/TwXgg1wNRvJTKwvGnDfClb4z75BxWnh0CBVjcE+h7t3UtSmZHzIn0STx5QxzHH34kfiJ0kBdQCQKNa2Um71vfEgUQ+7HPJE5WBBdZBCyKnCQAR7o6eg=; akavpau_p2=1637634116~id=fc77ae87e28dd1c77b1c482dd9ddc2c5; _px3=b228d286a61e20f8d2911268a268bf2bef7b4fcf1a5d3884916d41539be8552a:41KuhbgTZTGAWkkaRhNmmssQ/nRD7YO1Z2tRg6XQmUMDb+3N3fgkJneAzL6qOyU3y5dzNmRG54bWlapo5giagg==:1000:KzuAqTF7eFvVH0h2QV5xmkVxq8u9wAO6ND8Cn6SeIO2MyHYhZLdai/SIO51Ra/mzKi8y5l56pNeC3QLEmfd9CUdVJsRqeoFTgbkMKMuy5Dec1brgUXfczcNpWOk+kp7nSL0sgMdYMGtBn4T5hJCiiMUVy/jdHTsocYOqWrCCFnKXjKlutvbQPJYoIOfg9TblvxHqVN7Jp/1jSFlKvkR4aw==; com.wm.reflector="reflectorid:0000000000000000000000@lastupd:1637633542000@firstcreate:1637050244515"; tb-c30=scus-t1; xptwg=630107734:15119FACD5B5BB0:3741ADB:9358ED61:6D668D6A:884CB0CD:; TS01b0be75=01538efd7ce3d23ecff8cac5f76bb1df0cf9f1c0d18d3a0787e1f90334a0f16bb929186ac2aa4463e02579d8f6d134b56217fa44bf; TS013ed49a=01538efd7ce3d23ecff8cac5f76bb1df0cf9f1c0d18d3a0787e1f90334a0f16bb929186ac2aa4463e02579d8f6d134b56217fa44bf; bm_sv=3BF044EF2510F863A9462B794F321732~f1BG8ZwkcJOthLtq1RVAdyb6l+JVo5dSK6W8+zPYNaXFgJnVxfN5JSfMDNtnfsPZZUizI+PStcfL/HwEtZUdAi8Nujh1B820SedU3paICCe5R8tHU5wQlRJQZWZHnNkw35e/FVI7lNV+vyy1GraCkCc/h0pbMy90UB6xqeba/WU=; _pxde=76151d2f5223b16c0741275134fea02a9a3f9fc840fa3ef02329343cb4d1346a:eyJ0aW1lc3RhbXAiOjE2Mzc2MzM4MDA2NzYsImZfa2IiOjAsImlwY19pZCI6W119',
        'AID=wmlspartner%3D0%3Areflectorid%3D0000000000000000000000%3Alastupd%3D1637050244515; ACID=e57a8b4c-df53-4682-85a9-a0f6cf417ed1; hasACID=true; locGuestData=eyJpbnRlbnQiOiJTSElQUElORyIsInN0b3JlSW50ZW50IjoiUElDS1VQIiwibWVyZ2VGbGFnIjpmYWxzZSwicGlja3VwIjp7Im5vZGVJZCI6IjMwODEiLCJ0aW1lc3RhbXAiOjE2MzcwNTAyNDQ2MzJ9LCJwb3N0YWxDb2RlIjp7InRpbWVzdGFtcCI6MTYzNzA1MDI0NDYzMiwiYmFzZSI6Ijk1ODI5In0sInZhbGlkYXRlS2V5IjoicHJvZDp2MjplNTdhOGI0Yy1kZjUzLTQ2ODItODVhOS1hMGY2Y2Y0MTdlZDEifQ==; vtc=YeDTYcBVVJrmBJn6nfVFmc; TBV=7; adblocked=false; _pxvid=b2839e3b-46b4-11ec-a6e3-585a4b527450; tb_sw_supported=true; assortmentStoreId=3081; hasLocData=1; TB_Latency_Tracker_100=1; TB_Navigation_Preload_01=1; TB_SFOU-100=1; pxcts=6ed258c0-4b62-11ec-82f8-f9a9d8a34d30; _pxhd=r6dvKON-u/RjdIQSrB34fY7g4DCVHj/mEQ5yGlyO0mv8xR6-JrRmAQx2aZcyaCQU/fX4vhnYe-7OxAJkV5cC/g==:5vEXDF0wSSODK44ckJmsp0E6zYSTDHW/AFYC8AQI7gqhUHBFlgsA0XqTwDXxIk8Y3QMcHCR6DFvyOnQ7ZZLrTStEZOJRSMfo4QkeARg9FVk=; ak_bmsc=EA4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ktYTBmNmNmNDE3ZWQxIn0=; TB_DC_Flap_Test=0; bstc=ajKMIo9vpwlbEzyAmfv2zo; mobileweb=0; xpa=; xpm=3+1637630743+YeDTYcBVVJrmBJn6nfVFmc~+0; auth=MTAyOTYyMDE4znGm2ANEIB+T4KvLdbeyV1Sfq0qx+cXWUfeIShm7S2W2P7GkCYi7ekc0IJ9jXWO5IHuvxUZkOnxePCTtK7wgyPmya3spLau9B5jiDkR7sHIqJEEhjLzfZ9dTkdF/5mvs767wuZloTfhm7Wk2KcjygglTqinKgSpV0hco0QKmh1CakFS+talRIupwnY65O9IPm/8h90De3TZDsXp8tQe7zbeZFyV7y7yAPWfaw2U/5/sUMk70P8glgOEpLOprhDfMywI05adPtwc9/m5r1ONHR2MHgaT3GSSkX1t2O2E3L5yC67XZNwFiKC3/TwXgg1wNRvJTKwvGnDfClb4z75BxWnh0CBVjcE+h7t3UtSmZHzIn0STx5QxzHH34kfiJ0kBdQCQKNa2Um71vfEgUQ+7HPJE5WBBdZBCyKnCQAR7o6eg=; tb-c30=scus-t1; akavpau_p2=1637634404~id=3047172416ab49d0a16463b00d99978b; com.wm.reflector="reflectorid:0000000000000000000000@lastupd:1637633807000@firstcreate:1637050244515"; xptwg=3845900662:2200885FFE5F500:592D161:9095C7E1:831A8353:6A57815D:; TS013ed49a=01f7e3fb9515c3926ff2758aa20c2dd733d9e8c218326b52ac5ace9e451b81e25e9b23e73bd3ba3ef46a06c5793b1e2ba7cbdb1241; TS01b0be75=01538efd7c2d57681abdfbf99f33f5f0c0060b7bf89beffc08751e4b0b6bf166c99fdaa420420b2fcbd97ecab78894ac08748ddd97; bm_sv=3BF044EF2510F863A9462B794F321732~f1BG8ZwkcJOthLtq1RVAdyb6l+JVo5dSK6W8+zPYNaXFgJnVxfN5JSfMDNtnfsPZZUizI+PStcfL/HwEtZUdAi8Nujh1B820SedU3paICCf0KEGKEhLGpI8KQEmGJUvZeXAKoACDK+/6ihRxASuZ3483JSz79y46WQPM5werrfU=; _pxff_rf=1; _pxff_fp=1; _pxff_cfp=1; _pxff_tm=1; _px3=192a23387aa7f5efa94a01f91bbe257f4667185d8c70ae2d3c05d73e783d1989:0mZHgX1RWXaVkQRjBlKy21o2hKeGEaGhPXqwheqCBAKqzTONI5+0Th06o35V66Tm6BNlOrF9PPF53dhfyEBoZg==:1000:hzY5w+JpHGJQWof91nlqRuFVIo4iUrxmwfinZT+Jw43B2dGRx8Bh6BRb0GOoUUhzvf56gXa6O1ILu0gX2BXYC6hnb/+Y8o1D1DS/eyMhy2cmgZXWquXjr5sohY0UFES/7mUjamJCnxwY+Ixwth/WoCPlMVraW7VOys2ODk+LvbW37fvKmruBpNE/rA8XyBp5lFaN8QyZZfP1cWAAT6neBA==; _pxde=7db0a0be77abeaaca2374805a8da99021aac6427e0cf5d419576025a44511600:eyJ0aW1lc3RhbXAiOjE2Mzc2MzM5Nzc0NTcsImZfa2IiOjAsImlwY19pZCI6W119',
    ]

    return co[random.randint(1, 10)]
# def ips():
#     re_ip = requests.get(
#         'http://tiqu.pyhttp.taolop.com/getip?count=1&neek=10466&type=1&yys=0&port=2&sb=&mr=2&sep=1&time=2').content.decode()
#     print(re_ip)
#     time.sleep(2)
#     return re_ip


def ua():
    ua_pool = [

        "Mozilla/5.0 (Windows NT 6.2;en-US) AppleWebKit/537.32.36 (KHTML, live Gecko) Chrome/59.0.3047.101 Safari/537.32",

        "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36",

        "Mozilla/5.0 (Linux; Android 9; Mi Note 3 Build/PKQ1.181007.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045609 Mobile Safari/537.36 MMWEBID/4799 MicroMessenger/8.0.2.1860(0x2800023D) Process/tools WeChat/arm64 Weixin NetType/4G Language/zh_CN ABI/arm64",

        "Mozilla/5.0 (Linux; U; Android 10; zh-cn; MI 9 Build/QKQ1.190825.002) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/71.0.3578.141 Mobile Safari/537.36 XiaoMi/MiuiBrowser/13.3.12",
    ]
    return ua_pool[random.randint(1, 10)]


def headerss():
    headers = {
        'Host': 'www.walmart.com',
        'Connection': 'keep-alive',
        'Cache-Control': 'max-age=0',
        'sec-ch-ua': '"Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"',
        'sec-ch-ua-mobile': '?0',
        'Upgrade-Insecure-Requests': '1',
        'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36",
        'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
        'Service-Worker-Navigation-Preload': 'true',
        'Sec-Fetch-Site': 'same-origin',
        'Sec-Fetch-Mode': 'navigate',
        'Sec-Fetch-User': '?1',
        'Sec-Fetch-Dest': 'document',
        'Accept-Encoding': 'gzip, deflate, br',
        'Accept-Language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
        'Cookie': f'{cook()}',

    }
    # print('*'*50)
    # print(headers)
    print('*'*50)
    return headers


def maga():
    list1 = 0
    for uurl in words():
        list1 += 1
        uurl = uurl.strip()
        print(f'第{list1}开始获取中！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！')
        print(uurl)
        try:
            run(uurl)
        except Exception as g:
            try:
                run1(uurl)
            except Exception as g:
                continue


def run(uurl):
    # url = 'http://www.walmart.com/ip/Women-s-Electric-USB-Winter-Heated-Vest-Warm-Slim-Heating-Coat-Jackets-Sleeveless-Padded-Machine-Washable-Double-Button-Control-3-Temperature-Gear/495824768'
    response = requests.get(uurl, headers=headerss()).content.decode()
    # print('response1', response)
    res = etree.HTML(response)
    huoqu(res, uurl)


def run1(uurl):
    # proxy = {
    #     'https': f'{ips()}',
    #     'http':f'{ips()}'
    # }
    # url = 'http://www.walmart.com/ip/Women-s-Electric-USB-Winter-Heated-Vest-Warm-Slim-Heating-Coat-Jackets-Sleeveless-Padded-Machine-Washable-Double-Button-Control-3-Temperature-Gear/495824768'
    response = requests.get(uurl, headers=headerss()).content.decode()
    # print('response1', response)
    res = etree.HTML(response)
    huoqu(res, uurl)


def huoqu(res, uurl):
    src = res.xpath('//img/@src')  # 图片链接
    # print(src,type(src))
    str0 = ''
    for i in src:
        if i[:5] == 'https' and '?odnHeight=80&odnWidth=80&odnBg=FFFFFF' in i:
            str0 += '|' + i + '\n'
        # print(i)
    str2 = str0.replace('?odnHeight=80&odnWidth=80&odnBg=FFFFFF', '')
    # print(str2)
    color_size = res.xpath('//div[@class="w-100 f6 mt2"]/div[@class="mb2 mid-gray"]/span')
    try:
        color_lei = color_size[0].text
        color = color_size[1].text  # 颜色
    except Exception as g:
        color_lei = None
        color = None
    try:
        size1_lei = color_size[2].text
        size1 = color_size[3].text  # 尺寸
    except Exception as g:
        size1_lei = None
        size1 = None
    # print(color, size1)
    try:
        load = res.xpath('//script')
        # print(load[4].text,type(load[4]))
        str1 = ''
        for a in json.loads(load[4].text)["itemListElement"]:
            # print(a["item"]["name"])
            str1 += a["item"]["name"] + '/'
        # print(str1)  # 路径
    except Exception as g:
        str1 = 'None'
    title = res.xpath('//h1[@class="f3 b lh-copy dark-gray mt1 mb2"]')[0].text
    # print(title)  # 标题
    price = res.xpath('//span[@itemprop="price"]')[0].text
    # print(price)  # 价格

    description = res.xpath('//script')
    description_all = ''
    # print(description)
    for e1 in description:
        # print(e1.text)
        if 'description' in str(e1.text):
            # print(e1.text)
            description1 = '<a>' + json.loads(e1.text)['description'] + '</a>'
            # print(description1)
            selector = parsel.Selector(description1)
            texts = selector.css("a ::text").getall()
            for text1 in texts:
                description_all += text1.strip()
                # print(text1.strip().replace(' ',''))
            break
    # print(description_all)
    # if 'Description' in str(e1.text) or 'Specifications' in str(e1.text):
    #     # print(e1.text)
    #     # print('**********************************************')
    #     # print()
    #     try:
    #         Description = re.findall('Description:(.*?)</', e1["description"], re.S)[0].replace('<br>','').replace('&nbsp;', '')
    #         print(Description)  # 描述
    #     except Exception as g:
    #         try:
    #             Description = re.findall('Specifications:(.*)<br><br>', e1["description"], re.S)[0].replace(
    #                 '<br>',
    #                 '').replace(
    #                 '&nbsp;', '').replace('</h2>', '').replace('<h2>', '').replace('<b>', '').replace('</b>', '')
    #         except Exception as g:
    #
    #             Description = None
    #         # print(Description)  # 描述
    itmeid = uurl.split('/')[-1]
    # print(itmeid)

    # print('*'*30)
    load1 = res.xpath('//script')
    for e in load1:
        # print(e.text)

        if 'specifications' in str(e.text):
            shuxing2 = json.loads(re.findall('specifications":(.*?),"warnings', e.text)[0])
            # print(shuxing2)
            SalePrice = price
            Title = title
            Specifications = shuxing2

            if color == None:

                VariationSpecific = [
                    {
                        "name": f"{size1_lei}",
                        "value": f"{size1}"
                    }
                ]
            elif size1 == None:
                VariationSpecific = [
                    {
                        "name": f"{color_lei}",
                        "value": f"{color}"
                    }
                ]
            else:
                VariationSpecific = [
                    {
                        "name": f"{color_lei}",
                        "value": f"{color}"
                    },
                    {
                        "name": f"{size1_lei}",
                        "value": f"{size1}"
                    }
                ]
            CategoryPath = str1[:-1]
            Images = str2[1:]
            SalePrice = str(SalePrice)
            Title = str(Title)
            Specifications = str(json.dumps(Specifications))
            VariationSpecific = str(json.dumps(VariationSpecific))
            CategoryPath = str(CategoryPath)
            Images = str(Images)
            Description = str(description_all)
            itmeid = f"{itmeid}".strip()
            mysql(SalePrice, Title, Specifications, VariationSpecific, CategoryPath,
                  Images, Description, itmeid)


def mysql(SalePrice, Title, Specifications, VariationSpecific, CategoryPath, Images, Description, itmeid):
    CrawlerTime = time.strftime('%Y/%m/%d %H:%M:%S')
    CrawlerStatus = '1'
    # sql = 'updata walmart_lunhui set SalePrice=%s,Title=%s,Specifications=%s,VariationSpecific=%s,CategoryPath=%s,Images=%s,CrawlerTime=%s,Description=%s values(SalePrice,Title,Specifications,VariationSpecific,CategoryPath,Images,CrawlerTime,Description)'
    cursor.execute(
        "update t_bi_walmart_listing_crawler set SalePrice=%s,Title=%s,Specifications=%s,VariationSpecific=%s,CategoryPath=%s,Images=%s,CrawlerTime=%s,Description=%s,CrawlerStatus=%s where ItemId=%s",
        [SalePrice, Title, Specifications, VariationSpecific, CategoryPath, Images, CrawlerTime, Description,
         CrawlerStatus, itmeid])

    conn.commit()
    print(SalePrice, '\n', Title, '\n', Specifications, '\n', VariationSpecific, '\n', CategoryPath, '\n',
          Images, '\n', Description, '\n', itmeid)


def all_xpath(uurl, headers):
    print(uurl)


if __name__ == '__main__':
    maga()
